package com.wyj.wuliwuli.controller;

import com.wyj.wuliwuli.common.AjaxRequest;
import com.wyj.wuliwuli.common.AjaxResult;
import com.wyj.wuliwuli.common.PageParam;
import com.wyj.wuliwuli.entity.WuliUserVideoLike;
import com.wyj.wuliwuli.entity.WuliVideo;
import com.wyj.wuliwuli.service.WuliUserVideoLikeService;
import com.wyj.wuliwuli.service.WuliVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "喜欢")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/wuli-user-video-like")
public class WuliUserVideoLikeController {

    private final WuliUserVideoLikeService wuliUserVideoLikeService;

    @ApiOperation(value = "分页查询")
    @PostMapping("/page")
    public AjaxResult page(@RequestBody AjaxRequest<PageParam> ajaxRequest) {
        return wuliUserVideoLikeService.page(ajaxRequest);
    }

    @ApiOperation(value = "根据id查询")
    @GetMapping("/{id}")
    public AjaxResult getById(@PathVariable Long id) {
        return wuliUserVideoLikeService.getById(id);
    }

    @ApiOperation(value = "根据用户id查询")
    @GetMapping("/user/{userId}")
    public AjaxResult getByUserId(@PathVariable Long userId) {
        return wuliUserVideoLikeService.getByUserId(userId);
    }

    @ApiOperation(value = "保存")
    @PostMapping("/save")
    public AjaxResult save(@RequestBody AjaxRequest<WuliUserVideoLike> ajaxRequest) {
        return wuliUserVideoLikeService.save(ajaxRequest);
    }

    @ApiOperation(value = "根据id删除")
    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable Long id) {
        return wuliUserVideoLikeService.deleteById(id);
    }



}
